<?php

namespace App\Models;

use Dcat\Admin\Traits\HasDateTimeFormatter;

use Illuminate\Database\Eloquent\Model;

class UserCoin extends Model
{
    use HasDateTimeFormatter;

    protected $table = 'user_coin';

    protected $fillable = [
        'user_id',
        'coin_id',
        'content',
    ];

    const PAY_STATUS_YES = 1;
    const PAY_STATUS_NO = 0;

    const PAY_STATUS = [
        self::PAY_STATUS_NO => '未兑付',
        self::PAY_STATUS_YES => '已兑付',
    ];

    const APPLY_STATUS_YES = 1;
    const APPLY_STATUS_NO = 0;
    const APPLY_STATUS_OFF = 9;

    const APPLY_STATUS = [
        self::APPLY_STATUS_NO => '未申请',
        self::APPLY_STATUS_YES => '已申请',
    ];

    public function user()
    {
        return $this->belongsTo(User::class);
    }

    public function coin()
    {
        return $this->belongsTo(Coin::class);
    }
}
